﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Bussiness;

namespace EWebsite.Admin.Feedback {
    public partial class UpdateInventory : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack) {
                PartnerBuss partner = new PartnerBuss();
                drpPartner.DataTextField = "PartnerLoginName";
                drpPartner.DataValueField = "PartnerID";
                drpPartner.DataSource = partner.getPartnerList();
                drpPartner.DataBind();                
            }
        }

        protected void btnView_Click(object sender, EventArgs e) {
            int partnerID = 0;
            try {
                partnerID = int.Parse(drpPartner.SelectedValue);
            }
            catch (Exception ex) {
                return;
            }
            TransactionBuss buss = new TransactionBuss();
            grvFeedback.DataSource = buss.getPartnerTransaction(partnerID);
            grvFeedback.DataBind();
        }

        protected void drpPartner_SelectedIndexChanged(object sender, EventArgs e) {
            if (!IsPostBack) {
                int partnerID = 0;
                try {
                    partnerID = int.Parse(drpPartner.SelectedValue);
                }
                catch (Exception ex) {
                    return;
                }
                TransactionBuss buss = new TransactionBuss();
                grvFeedback.DataSource = buss.getPartnerTransaction(partnerID);
                grvFeedback.DataBind();
            }
        }
    }
}